from sqlalchemy import Column, String
from sqlalchemy.orm import Mapped, mapped_column, relationship

from .base import TimedBaseModel


class Category(TimedBaseModel):
    __tablename__ = "category"

    id: Mapped[int] = mapped_column(primary_key=True)
    title_ru = Column(String(255), nullable=False)
    title_en = Column(String(255), nullable=False)
    title_uk = Column(String(255), nullable=False)
    calendars = relationship("Calendar", back_populates="category")

    def __str__(self):
        return self.title_ru

    def __repr__(self):
        return f"<Категория №{self.id} {self.title_ru}>"
